<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/js/web/frame/jedate/skin/jedate.css')}}">
    <script src="{{asset('/js/web/frame/jedate/jquery.jedate.js')}}"></script>
    <link rel="stylesheet" href="{{asset('/css/web/user/order_list.css')}}">
    <link rel="stylesheet" href="{{asset('/css/web/user/return_bill.css')}}">
    <script src="{{asset('/js/web/user/order_list.js')}}"></script>
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.buyer_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title" style="border-bottom: 1px dashed #ccc">退货/款订单</div>
                <div class="search f-cb">
                    <form action="" method="get">
                        <input name='keyword' type="text" id="shop_name" class="text fl" placeholder="商品名称/商家名称" value='{{$search_params['shop_name']}}'>
                        <input name='change_product' id="change_product" type="hidden" placeholder="商品名称" value=''>
                        <select class="select fl" name='status'>
                            <option value='6' <?php if(isset($search_params['status'])){ if($search_params['status']==6){ echo "selected = selected";}else{ echo "" ;} ;} ?> >所有退单类型</option>
                            <option value='0'  <?php if(isset($search_params['status'])){ if($search_params['status']==0){ echo "selected = selected";}else{ echo "" ;} ;} ?> >提交申请</option>
                            <option value='1'  <?php if(isset($search_params['status'])){ if($search_params['status']==1){ echo "selected = selected";}else{ echo "" ;} ;} ?>>同意退款</option>
                            <option value='2'  <?php if(isset($search_params['status'])){ if($search_params['status']==2){ echo "selected = selected";}else{ echo "" ;} ;} ?>>同意退货</option>
                            <option value='3'  <?php if(isset($search_params['status'])){ if($search_params['status']==3){ echo "selected = selected";}else{ echo "" ;} ;} ?>>拒绝</option>
                            <option value='4'  <?php if(isset($search_params['status'])){ if($search_params['status']==4){ echo "selected = selected";}else{ echo "" ;} ;} ?>>确认收货</option>
                            <option value='5'  <?php if(isset($search_params['status'])){ if($search_params['status']==5){ echo "selected = selected";}else{ echo "" ;} ;} ?>>完成</option>
                        </select>

                        <input type="submit" class="submit fr" value="查询">
                    </form>
                </div>
                <div class="tit f-cb">
                    <div class="pr fl">订单商品</div>
                    <div class="pes fl">数量 </div>
                    <div class="mon fl">金额</div>
                    <div class="sta fl">退货/款状态<i></i></div>
                    <div class="op fl">操作</div>
                </div>
                @foreach($list as $v)
                <div class="content">
                    <div class="order">
                        <div class="boxtop f-cb">
                            <div class="number fl">退货单号：<a href="">{{$v['change_code']}}</a></div>
                            <div class="business fl">商家名称：<a href="" target="_blank">{{$v['shop_name']}}</a></div>
                            <a href="javascript:;" class="delete flr" data-id=></a>
                            <div class="time flr">下单时间：{{date('Y-m-d',strtotime($v['order']['created_at']))}}
                            </div>
                        </div>
                        <div class="info">
                            <table>

                                @foreach($v['order_products'] as $key => $val)
                                    @if(count($v['order_products']) - $key>=1)
                                        <tr>
                                            <td width="80" height="100" class="imgbox">
                                                <img src="{{asset('/img/web/user/video1.jpg')}}" width="80" height="80">
                                            </td>
                                            <td width="265" height="100" class="goods_name_box">
                                                <div class="goods_name">
                                                    <a target='_blank' href="">{{$val['product_name']}}</a>
                                                </div>
                                                <div class="goods_num">订单单号：{{$val['order_code']}}</div>
                                            </td>
                                            <td width="40" height="100" class="num" ></td>
                                            <td width="99" height="100" class="name" rowspan="{{count($v['order_products'])>1?count($v['order_products'])-1:""}}">{{$val['quantity']}}</td>

                                            <td width="150" height="100" class="price" rowspan="{{count($v['order_products'])>1?count($v['order_products']):""}}" style="border-bottom:1px solid #e6e6e6 ">
                                                <div class="cost">
                                                    <span class="tt"><span class="rmb">￥</span>{{$v['change_money']}}</span>
                                                </div>
                                            </td>
                                            <td width="150" height="100" class="statebox" rowspan="{{count($v['order_products'])>1?count($v['order_products']):""}}">
                                                <div>{{$v['status_name']}}</div>
                                            </td>
                                            <td width="150" height="100" class="paybox" rowspan="{{count($v['order_products'])>1?count($v['order_products']):""}}">
                                                <div class="btnbox">
                                                    <a href="" class="close jm_hover" style="display: block;">订单详情</a>
                                                    <!-- <a href="" >查看申请进度</a> -->
                                                    <p class="order_speed" data-id='1' style="color: #028eef;" >查看申请进度</p>
                                                </div>
                                            </td>
                                        </tr>
                                    @else
                                        <tr>
                                            <td width="80" height="100" class="imgbox">
                                                <img src="{{asset('/img/web/user/video1.jpg')}}" width="80" height="80">
                                            </td>
                                            <td width="265" height="100" class="goods_name_box">
                                                <div class="goods_name">
                                                    <a target='_blank' href="">{{$val['product_name']}}</a>
                                                </div>
                                                <div class="goods_num">订单单号：{{$val['order_code']}}</div>
                                            </td>
                                            <td width="40" height="100" class="num" ></td>
                                            <td width="99" height="100" class="name" rowspan="">{{$val['quantity']}}</td>
                                        </tr>
                                    @endif
                                @endforeach


                            </table>
                            <div class="order_state">
                                <ul class="order_finish">
                                    <li class="order_first one">
                                        <h3 class="submit">提交申请</h3>
                                        <div class="spend">
                                            <p class="quan">1</p>
                                            <img class="quan1" src="{{asset('/img/web/user/yleft.png')}}" alt="">
                                        </div>
                                        <h4 class="order_day order_day1">
                                            {{$v['created_at']}}
                                        </h4>
                                    </li>
                                    @if($v['status']==3)
                                        <li class="order_first second">
                                            <h3 class="submit">申请拒绝</h3>
                                            <div class="spend">
                                                <p class="quan">2</p>
                                                <img class="quan4" src="{{asset('/img/web/user/quan.png')}}" alt="">
                                                <img class="green3"src="{{asset('/img/web/user/yright.png')}}" alt="">
                                            </div>
                                            <h4 class="order_day order_day2">{{$v['agree_at']}}</h4>
                                        </li>
                                    @else
                                        <li class="order_first second">
                                            <h3 class="submit">卖家同意</h3>
                                            <div class="spend">
                                                <p class="quan">2</p>
                                                @if($v['status']>=1)

                                                    <img class="green_1"src="{{asset('/img/web/user/yleft.png')}}" alt="">
                                                    <img class="green2"src="{{asset('/img/web/user/yright.png')}}" alt="">
                                                @endif

                                            </div>
                                            <h4 class="order_day order_day2">
                                                {{$v['agree_at']}}
                                            </h4>
                                        </li>
                                    @endif

                                        <li class="order_first third">
                                            <h3 class="submit">退货/款中</h3>
                                            <div class="spend">
                                                <p class="quan">3</p>
                                                @if($v['status']>=4)

                                                    <img class="green_2"src="{{asset('/img/web/user/yleft.png')}}" alt="">
                                                    <img class="green4"src="{{asset('/img/web/user/yright.png')}}" alt="">
                                                @endif

                                            </div>
                                            <h4 class="order_day order_day3">
                                                {{$v['receipt_at']}}
                                            </h4>
                                        </li>

                                        <li class="order_first fourth">
                                            <h3 class="submit">交易完成</h3>
                                            <div class="spend">
                                                <p class="quan">4</p>
                                                @if($v['status']==5)

                                                <img class="quan4" src="{{asset('/img/web/user/quan.png')}}" alt="">
                                                <img class="green3"src="{{asset('/img/web/user/yright.png')}}" alt="">
                                                @endif

                                            </div>
                                            <h4 class="order_day order_day4">
                                                {{$v['updated_at']}}
                                            </h4>
                                        </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                @endforeach
                <div class="page">
                    @include('web.common.paginate')

                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
<script type="text/javascript">
   $(function(){

     $(".order_speed").on("click",function(event){
        event ? event : window.event; 
        var obj = event.srcElement ? event.srcElement : event.target; 
        var $obj = $(obj); 
        $obj.parent().parent().parent().parent().parent().next().toggle()
     })
   })
</script>
</body>
</html>